package cn.gmcx.lazy.izze.utils;

import java.net.URI;
import java.net.URISyntaxException;

public class OssGetObjectNameUtils {
    private OssGetObjectNameUtils() {
    }

    public static String getObjectName(String fileName){
        try {
            URI uri = new URI(fileName);
            String path = uri.getPath();
            System.out.println(path);
            // 去掉开头的斜杠
            if (path.startsWith("/")) {
                path = path.substring(1);
            }

           return path;
        } catch (URISyntaxException e) {
            e.printStackTrace();
            return "出错";
        }
    }
}
